home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Science
/
Asymptote Demo
/
Examples
/
Utility Scripts
/
drawdoublearrow
< prev
next >
Wrap
Text File
|
1994-05-07
|
1KB
|
44 lines
% drawdoublearrow xstart ystart xend yend Label
% Draw a double arrowheaded line with a label
% ARGUMENTS:
% xstart,ystart -- x and y of start of line
% xend, yend -- x and y of end of line
% Label -- label for the center of the line
% DESCRIPTION:
% Draw a line with arrow heads on both ends from
% (xstart,ystart) to (xend, yend), place a label
% in the center of the line and cap the ends of
% the lines with a bar like this:
% |<-------Label----->|
%
% ----------------------------------------------------------
% Hide this window
hide
% This is what we are going to use for the cap
pointsymbol 2 cross
% Find the rotation angle from the slope of the line
rotation &1 &2 &3 &4
% Move to the center and draw the label
moveto &1 &3 + 2 / &2 &4 + 2 /
drawlabel above &5
% Reposition the pen in the center
moveto &1 &3 + 2 / &2 &4 + 2 /
% Draw and arrow to one end
drawarrowto &1 &2
rotation rotation 90 +
% Draw the end cap
drawpoint
rotation rotation 90 -
% Move back to the center
moveto &1 &3 + 2 / &2 &4 + 2 /
% Draw the other arrow and end cap
drawarrowto &3 &4
rotation rotation 90 +
drawpoint
rotation rotation 90 -